﻿using UnityEngine;

namespace Code.UI
{
    public class SkillConfigView:MonoBehaviour
    {
        [SerializeField] private Transform _skillConfigDialog;

        [SerializeField] private GameObject _skillGUIPrefab;
        [SerializeField] private Transform _skillConfigListParent;
        private SkillSystem _skillSystem;

        private void Awake()
        {
            _skillSystem = GameObject.FindObjectOfType<SkillSystem>();
        }
        private void Start()
        {
            foreach (var item in _skillSystem.Skills)
            {
                var skillGUI=GameObject.Instantiate(_skillGUIPrefab,_skillConfigListParent);
                var skillGui=skillGUI.GetComponent<SkillGUI>();
                skillGui.Init(item,_skillConfigDialog);
            }
        }
    }
}
